<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * @author TUNAFISHIE
 */
class floorplans extends CI_Controller{

 function __construct() {
        parent::__construct();
        $this->load->model('floorplans_model');
    }
	public function getFloorplans($level){        
        $xmlfloorplansUrl = $this->config->item('floorplans_xml');
        
        
        $output = $this->floorplans_model->parseFloorplansXml($xmlfloorplansUrl,intval($level));
		
        $this->retJsonP($output);
    }
	 function retJsonP($output) {
		 
            header('Content-Type: application/x-json');
            echo json_encode($output);
      
    }
	public function getFloorplans2($level){        
        $xmlfloorplansUrl = $this->config->item('floorplans_xml');
        
        
        $output = $this->floorplans_model->parseFloorplansXml($xmlfloorplansUrl,intval($level));
		
        $this->retJsonP2($output);
    }
	 function retJsonP2($output) {
		 
            $callback = $_REQUEST['callback'];

        if ($callback) {
            header('Content-Type: text/javascript');
            echo $callback . '(' . json_encode($output) . ');';
        } else {
            header('Content-Type: application/x-json');
            echo json_encode($output);
        }
    }
}

?>
